Skip to content

docs(vue): update useIonRouter replace direction - #4794

Merged
ShaneK merged 1 commit into
mainfrom
FW-7870
Oct 20, 2026
Merged

ShaneK merged 1 commit into
mainfrom
FW-7870

Conversation

@ShaneK

@ShaneK ShaneK commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

What is the current behavior?

Currently, the useIonRouter docs say replace is the same as navigate(location, 'root', 'replace', animation), which clears the navigation stack. The navigate type also leaves out the none direction.

What is the new behavior?

The docs now say replace uses the none direction, so it keeps the pages beneath the replaced one and back still works. They also point to navigate(location, 'root', 'replace') for clearing the stack, and none is added to the type. This is for v9 only.

Important

This needs to be merged only after ionic-team/ionic-framework#31583

@ShaneK
ShaneK requested a review from a team as a code owner October 16, 2026 18:27
@ShaneK
ShaneK requested a review from thetaPC October 16, 2026 18:27
@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Oct 16, 2026 6:27pm UTC

Request Review

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShaneK
ShaneK merged commit 3d33ac7 into main Oct 20, 2026
7 checks passed
@ShaneK
ShaneK deleted the FW-7870 branch October 20, 2026 15:23
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-ionic-team__ionic-framework that referenced this pull request Oct 20, 2026
…nic-team#31583)

Issue number: resolves ionic-team#30617

---------

## What is the current behavior?

Currently, replacing a page inside a tab stack breaks going back in two
different ways. Calling `useIonRouter().replace()` shows a back button
that does nothing, because `replace()` sends the `root` direction, which
clears the location history but leaves `pushedByRoute` set. Calling
`navigate(path, 'forward', 'replace')` after switching tabs does the
opposite, so the URL goes back but the replaced page stays on screen.
That one happens because the back button calls `router.go(-3)` and the
router assumes the page we left is only one entry ahead.

## What is the new behavior?

Now `replace()` uses the `none` direction, so it keeps the pages beneath
the one it replaced and still doesn't animate, the same as a plain
`router.replace()`. The router also uses the real history delta to find
the page we left, and an explicit `navigate(url, 'root', 'replace')` no
longer shows a back button since there's nothing to go back to.

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

## Other information

This does change `replace()` for apps that relied on it clearing the
history. That only started in 9.0, when ionic-team#31142 made the router respect
the caller's direction, and those apps can switch to `navigate(url,
'root', 'replace')`. I updated the `useIonRouter` docs in ionic-docs to
match here: ionic-team/ionic-docs#4794

This branch was successfully deployed

1 active deployment
Preview — 97d63fb8 Deployed Oct 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants